<template>
	<view class="bruce" id="conent">
		<ul class="bubble-bgwall">
			<li class="bubble">Vue</li>
			<li class="bubble">Vue</li>
			<li class="bubble">Vue</li>
			<li class="bubble">Vue</li>
			<li class="bubble">Vue</li>
			<li class="bubble">Vue</li>
			<li class="bubble">Vue</li>
			<li class="bubble">Vue</li>
			<li class="bubble">Vue</li>
			<li class="bubble">Vue</li>
		</ul>
		<view class="toptitle" @click="home">
			智能农业监控系统
		</view>
		<view class="showcontent">
			<view class="introduction">
				<scroll-view id="scrollview" scroll-y>

					<view class="userinfo">
						<view class="profilePicture">
							<text>{{username}}</text>
						</view>
						<view class="username">
							{{userid}}
						</view>
						<view class="createtime">
							<span>创建时间：</span>{{createtime}}
						</view>
					</view>

				</scroll-view>
			</view>
		</view>
		<view class="andshowcontent">
			<my-component :title="'我的'"></my-component>
			<view class="andintroduction">
				<view class="Refresh" @click="Refreshs">
					<image class="topRefresh" src="../../static/Refresh.png"></image>
				</view>
				<scroll-view id="andscrollview" scroll-y>

					<view class="userinfo">
						<view class="profilePicture">
							<text>{{username}}</text>
						</view>
						<view class="username">
							{{userid}}
						</view>
						<view class="createtime">
							<span>创建时间：</span>{{createtime}}
						</view>
						<view class="arrow">
							<image src="../../static/right.png"></image>
						</view>
					</view>
					<view class="directInfo">
						<ul>
							<li @click="InsiteCommunity">进入社区<view class="imges">
									<image src="../../static/right.png">
								</view>
								</image>
							</li>
							<li><a href="mailto:luohai084.163.com">联系客服</a>
								<view class="imges">
									<image src="../../static/right.png">
								</view>
								</image>
							</li>
							<li @click="homes">退出登录<view class="imges">
									<image src="../../static/right.png">
								</view>
								</image>
							</li>
							<li @click="aboutUs">关于<view class="imges">
									<image src="../../static/right.png">
								</view>
								</image>
							</li>
						</ul>
					</view>

				</scroll-view>
			</view>
			<Bottom-component></Bottom-component>
		</view>
		<view class="righttop">
			<span>当前用户：{{userid}}</span>
		</view>
		<view class="winfroted-glass">
			<ul class="nav1">
				<li class="title1" @click="home">系统简介</li>
				<li class="title1" id="nav2">进入系统
					<ul id="nav3">
						<li class="title2" @click="Deviceinformation">设备信息</li>
						<li class="title2" @click="Realtime">设备详情</li>
						<li class="title2" @click="statisticanalysis">统计分析</li>
						<li class="title2" @click="prediction">实时数据</li>
						<li class="title2" @click="historydata">历史数据</li>
					</ul>
				</li>
				<li class="title1" @click="relatedTechnologies">相关技术</li>
				<li class="title1" @click="InsiteCommunity">进入社区</li>
				<li class="title1" @click="teamSpirit">团队风采</li>
				<li class="title1" @click="aboutUs">关于我们</li>
			</ul>
		</view>
	</view>
</template>

<script>
	import MyComponent from '../my-component/my-component.vue';
	import {
		VUE_APP_BASE_URL
	} from 'utils/request.js';
	import {
		myrequest
	} from '../../utils/request';
	import {
		formatDate
	} from "../../utils/time.js";
	export default {
		components: {
			MyComponent
		},
		data() {
			return {
				cssid: '',
				userid: 'itheima00015',
				createtime: '2004.3.3',
				username: 'null',
				userinfolist: []
			}
		},
		onLoad(e) {
			this.cssid = e.cssid;
			this.namesubstring();
		},
		mounted() {
			this.draw();
			this.namesubstring();
			this.getUserinfo();
		},

		methods: {
			Refreshs(e) {
				this.namesubstring();
				this.getUserinfo()
			},
			//获取用户信息
			async getUserinfo() {
				let username = uni.getStorageSync('username');
				let userid = uni.getStorageSync('userid')
				// console.log(userid);
				let res = await myrequest({
					//await的作用为需要等待$myhttp请求成功后下执行下面的进程
					url: '/user/setUserinfo',
					data: {
						userid: userid,
					},
					method: "POST",
				}).then(res => {
					if (Array.isArray(res.data.data)) {
						this.devicelist = res.data.data.map(item => {
							// 格式化时间戳，假设 createtime 是以毫秒为单位的 Unix 时间戳  
							item.createtime = formatDate(item.createtime * 1000);
							return item;
						});
					}
					if (res.data.data.length > 0) {
						this.userinfolist = res.data.data[0]
						this.userid = this.userinfolist.username
						this.createtime = this.userinfolist.createtime
					}

				});
			},
			namesubstring() {
				let str = this.userid;
				let subStr = str.substring(0, 1);
				this.username = subStr
			},
			historydata() {
				uni.navigateTo({
					url: '/pages/historydata/historydata?cssid=' + this.cssid
				})
			},
			prediction() {
				uni.navigateTo({
					url: '/pages/prediction/prediction?cssid=' + this.cssid
				})
			},
			statisticanalysis() {
				uni.navigateTo({
					url: '/pages/statisticanalysis/statisticanalysis?cssid=' + this.cssid
				})
			},
			Realtime() {
				uni.navigateTo({
					url: '/pages/Realtime/Realtime?cssid=' + this.cssid
				})
			},
			Deviceinformation() {
				uni.navigateTo({
					url: '/pages/Deviceinformation/Deviceinformation?cssid=' + this.cssid
				})
			},
			LoginRegister(e) {
				let userid = uni.getStorageSync('userid')
				console.log(userid);
				if (userid !== '') {
					uni.navigateTo({
						url: '/pages/Deviceinformation/Deviceinformation?cssid=' + this.cssid,
						animationType: 'zoom-fade-out', // 指定动画类型
						animationDuration: 300 // 动画时长
					})
				} else {
					uni.navigateTo({
						url: '/pages/LoginRegister/LoginRegister?cssid=' + this.cssid,
						animationType: 'zoom-fade-out', // 指定动画类型
						animationDuration: 300 // 动画时长
					})
				}
			},
			teamSpirit() {
				uni.reLaunch({
					url: '/pages/teamSpirit/teamSpirit?cssid=' + this.cssid,
					animationType: 'zoom-fade-out', // 指定动画类型
					animationDuration: 300 // 动画时长
				})
			},
			InsiteCommunity() {
				uni.navigateTo({
					url: '/pages/InsiteCommunity/InsiteCommunity?cssid=' + this.cssid,
					animationType: 'zoom-fade-out', // 指定动画类型
					animationDuration: 300 // 动画时长
				})
			},
			relatedTechnologies() {
				uni.navigateTo({
					url: '/pages/relatedTechnologies/relatedTechnologies?cssid=' + this.cssid,
					animationType: 'zoom-fade-out', // 指定动画类型
					animationDuration: 300 // 动画时长
				})
			},
			aboutUs() {
				uni.navigateTo({
					url: '/pages/aboutUs/aboutUs?cssid=' + this.cssid,
					animationType: 'zoom-fade-out', // 指定动画类型
					animationDuration: 300 // 动画时长
				})
			},
			forgotpassword(e) {
				uni.navigateTo({
					url: '/pages/forgotpassword/forgotpassword?cssid=' + this.cssid,
					animationType: 'zoom-fade-out', // 指定动画类型
					animationDuration: 300 // 动画时长
				})
			},
			homes() {
				let userid = ''
				uni.setStorageSync('userid', userid);
				uni.navigateTo({
					url: '/pages/home/home',
					animationType: 'fade-in', // 指定动画类型
					animationDuration: 300 // 动画时长
				})
			},
			home() {
				uni.navigateTo({
					url: '/pages/home/home'
				})
			},
			draw(e) {
				let themes = document.querySelector('.bruce');
				let color = document.querySelectorAll(".bubble")
				let userid = uni.getStorageSync('userid')
				let username = uni.getStorageSync('username');
				this.userid = username
				if (this.cssid == 1) {
					this.button = false;
					this.title = "白天模式"
					this.cssid = 1
					themes.style.background = 'linear-gradient(270deg, #0a0b35, #120144)'
					color.forEach(function(element) {
						element.style.color = '#83c0f7'
					});

				} else {
					this.title = "夜间模式"
					this.button = true;
					this.cssid = 0
					themes.style.background = 'linear-gradient(270deg, #819cad, #81a5bd)'
					color.forEach(function(element) {
						element.style.color = '#6661e6'
					});

				}
			}

		}
	}
</script>

<style lang="scss">
	@media screen and (min-width:640px) {
		#conent {
			background: #030812 !important;

			.toptitle {
				position: fixed;
				margin-left: 5px;
				width: 100%;
				padding: 20px;
				z-index: 12;
				font-size: 24px;
				font-family: "楷体", sans-serif;
				top: 0px;
				font-weight: bold;
				color: #d8d8d8;
				left: 0;
				display: block;
				background: #393d49;
				background-image: url('https://gd-hbimg.huaban.com/23c7d4ff432744f58bbd2087eb6745a4f66d95c757996-Z6BbHB_fw1200');
				background-repeat: no-repeat;
				background-size: 100vw;
			}

			.righttop {
				position: fixed;
				margin-left: 5px;
				width: 50%;
				padding: 20px 40px 20px 0;
				z-index: 12;
				font-size: 24px;
				font-family: "楷体", sans-serif;
				top: 0;
				font-weight: bold;
				color: #d8d8d8;
				right: 0;
				display: block;
				text-align: right;
				background: transparent;

				span {
					&:hover {
						color: #009688;
					}
				}
			}

			.showcontent {
				background: rgba(255, 255, 255, 0.5);
				z-index: 10;
				display: block;
				justify-content: center;
				position: fixed;
				left: 0;
				margin: 0 50px 0 50px;
				width: 100%;
				height: 100%;
				backdrop-filter: blur(3px);

				.introduction {
					background-color: rgba(0, 0, 0, 0.126);
					display: block;
					overflow: hidden auto;
					box-sizing: border-box;
					position: relative;
					margin-top: 120px;
					margin-left: 120px;
					margin-right: 100px;
					padding: 20px;
					border-radius: 5px;


					#scrollview {
						width: 100%;
						height: 80vh;
						background-color: transparent;
						overflow: hidden auto;
						margin: auto;


						.userinfo {
							background-image: linear-gradient(to top right, #646464, #4a939e);
							background-image: url('https://gd-hbimg.huaban.com/030955d4574157fc48ec5124d3e12e358de28f2c1b61ff-MmSgr3_fw1200');
							background-repeat: no-repeat;
							background-size: 100vw;
							background-position: center center;
							background-size: cover;
							padding: 50px 10px;
							width: 80%;
							border-radius: 5px;
							margin: 100px auto;
							overflow: hidden;

							.profilePicture {
								background-color: rgba(255, 255, 255, 0.15);
								text-transform: uppercase;
								width: 250px;
								height: 250px;
								border-radius: 43% 57% 58% 42% / 40% 39% 61% 60%;
								margin: 20px auto;
								position: relative;
								box-sizing: border-box;
								box-shadow: inset 20px 20px 20px rgba(0, 0, 0, .05),
									25px 35px 20px rgba(0, 0, 0, .05),
									25px 30px 30px rgba(0, 0, 0, .05),
									inset -20px -20px 25px rgba(255, 255, 255, .5);
								border-radius: 40% 60% 56% 44% / 30% 35% 65% 70%;
								overflow: hidden;

								text {
									background-color: transparent;
									display: block;
									width: 100%;
									display: flex;
									color: #0f0f0f;
									align-items: center;
									justify-content: center;
									text-align: center;
									text-transform: uppercase;
									font-size: 50px;
									height: 100%;
								}

								&:before {
									content: '';
									position: absolute;
									top: 80px;
									left: 75px;
									width: 15px;
									height: 15px;
									border-radius: 50%;
									background-color: #ffffff;
									opacity: 0.8;
								}

								&::after {
									content: '';
									position: absolute;
									top: 50px;
									left: 55px;
									width: 30px;
									height: 30px;
									border-radius: 50%;
									background-color: #ffffff;
									opacity: 0.8;
								}

								&:hover {
									border-radius: 50%;
								}
							}

							.username {
								position: relative;
								text-align: center;
								font-size: 30px;
								background-color: rgba(255, 255, 255, 0.5);
								color: #0f0f0f;
								width: 70%;
								margin: 20px auto;
								padding: 10px;
								box-shadow: inset 20px 20px 20px rgba(0, 0, 0, .05),
									25px 35px 20px rgba(0, 0, 0, .05),
									25px 30px 30px rgba(0, 0, 0, .05),
									inset -20px -20px 25px rgba(255, 255, 255, .5);
								border-radius: 50px;

								&::before {
									content: '';
									position: absolute;
									width: 20%;
									height: 5px;
									top: 8px;
									left: 50%;
									transform: translateX(-50%);
									background-color: rgba(255, 255, 255, .5);
									opacity: 1;
									border-radius: 5px;
								}
							}

							.createtime {
								position: relative;
								text-align: center;
								font-size: 30px;
								background-color: rgba(255, 255, 255, 0.5);
								color: #0f0f0f;
								width: 70%;
								margin: 30px auto;
								padding: 10px;
								box-shadow: inset 20px 20px 20px rgba(0, 0, 0, .05),
									25px 35px 20px rgba(0, 0, 0, .05),
									25px 30px 30px rgba(0, 0, 0, .05),
									inset -20px -20px 25px rgba(255, 255, 255, .5);
								border-radius: 50px;

								&::before {
									content: '';
									position: absolute;
									width: 20%;
									height: 5px;
									top: 8px;
									left: 50%;
									transform: translateX(-50%);
									background-color: rgba(255, 255, 255, .5);
									opacity: 1;
									border-radius: 5px;
								}
							}

							&:hover {
								// background-color: rgba(194, 252, 252, .13);
								box-shadow: 0 0.7px 1px rgba(0, 0, 0, 0.157), 0 1.7px 2.6px rgba(0, 0, 0, 0.224), 0 3.5px 5.3px rgba(0, 0, 0, 0.28), 0 7.3px 11px rgba(0, 0, 0, 0.346), 0 20px 30px rgba(0, 0, 0, 0.5);
							}
						}


					}


				}

			}

			.andshowcontent {
				display: none;
			}

			.winfroted-glass {
				background-color: transparent;
				z-index: 10;
				width: 140px;
				display: flex;
				position: fixed;
				left: 0px;
				top: 10px;

				.nav1 {
					margin-top: 30px;
					width: 120px;
					height: 100vh;
					background-color: #393d49;
					position: relative;
					display: block;
					margin-left: 5px;
					box-sizing: border-box;
					padding: 50px 0 0 0;
					border-left: 5px solid #222e6f;
					justify-content: center;
					text-align: center;

					.title1 {
						width: 100%;
						margin: 10px auto;
						padding: 10px 0;
						list-style: none;
						text-align: center;
						color: #d8d8d8;
						transition: background-color 0.3s ease;

						&:hover {
							background: #009688;
							border-right: #ffffff 2px solid;
							cursor: pointer;
						}
					}

					.title1:nth-child(2) {
						#nav3 {
							display: none;
							overflow: hidden;
							box-sizing: border-box;
						}

						&:hover {
							#nav3 {
								display: block;
								position: relative;
								margin-top: 10px;
								left: 0px;
								width: 100%;

								.title2 {
									width: 100%;
									left: -14px;
									margin: 10px auto;
									position: relative;
									padding: 10px 0;
									list-style: none;
									display: block;
									text-align: center;
									transition: background-color 0.3s ease;

									&:hover {
										display: block;
										width: 100%;
										margin: 10px auto;
										padding: 10px 0;
										list-style: none;
										display: block;
										text-align: center;
										background: linear-gradient(to left, #9cd3d3, #008174) no-repeat right bottom;
										background-size: 90% 2px;
										transition: background-size 0.3s;
									}
								}

								&:hover {
									background: #008174;
								}
							}
						}
					}


				}

			}
		}
	}

	.bruce {
		background-image: linear-gradient(270deg, #819cad, #81a5bd);
		height: 100vh;
		display: flex;
		justify-content: center;
		align-items: center;
		overflow: hidden;

		.showcontent {
			display: none;
		}

		.andshowcontent {
			z-index: 10;
			display: block;
			justify-content: center;
			position: fixed;
			margin: 0 50px 0 50px;
			width: 100%;
			height: 100%;

			.Refresh {
				display: block;
				position: relative;
				padding: 10px;
				bottom: -80vh;
				width: 50px;
				height: 50px;
				z-index: 10;
				right: 10px;
				float: right;
				background-color: rgba(67, 230, 244, 0.2);
				overflow: hidden;
				border-radius: 50%;
				box-sizing: border-box;
				filter: drop-shadow(1px 1px 20px #60fff5);

				.topRefresh {
					width: 100%;
					height: 100%;
				}

			}

			.andintroduction {
				background-color: rgba(0, 0, 0, 0.426);
				backdrop-filter: blur(2px);
				display: block;
				overflow: hidden;
				box-sizing: border-box;
				position: relative;
				margin-top: 10vh;
				margin-left: 0px;
				margin-right: 0px;
				bottom: 63px;
				padding: 10px;



				#andscrollview {
					width: 100%;
					padding-top: 60px;
					height: 90vh;
					padding-bottom: 5px;
					box-sizing: border-box;
					color: #eaeaea;
					font-size: 18px;
					background-color: transparent;

					.userinfo {
						background-image: linear-gradient(to top right, #646464, #4a939e);
						padding: 10px;
						border-radius: 5px;
						height: 120px;
						margin: 10px auto;

						.profilePicture {
							background-color: #f4f4f4;
							text-transform: uppercase;
							color: #ffffff;
							width: 49px;
							height: 49px;
							border-radius: 50%;
							margin: 10px;
							position: relative;
							box-sizing: border-box;
							border: 2px solid #393d49;
							left: 0px;
							overflow: hidden;

							text {
								background-color: transparent;
								display: block;
								width: 100%;
								display: flex;
								color: #000;
								align-items: center;
								justify-content: center;
								text-align: center;
								font-size: 24px;
								height: 100%;
							}
						}

						.username {
							width: 100px;
							background-color: transparent;
							position: relative;
							left: 70px;
							top: -47px;
						}

						.createtime {
							width: 200px;
							background-color: transparent;
							position: relative;
							top: -25px;
							font-size: 12px;
							left: 10px;
						}

						.arrow {
							background-color: transparent;
							width: 30px;
							height: 30px;
							position: relative;
							top: -75px;
							left: 75vw;

							image {
								width: 100%;
								height: 100%;
							}
						}
					}

					.directInfo {
						background-color: transparent;

						ul {
							list-style-type: none;
							margin: 0;
							padding: 0px;

							li {
								width: 100%;
								font-size: 16px;
								padding: 5px 10px;
								color: #080808;
								height: 43px;
								overflow: hidden;
								box-sizing: border-box;
								margin: 10px 0px;
								line-height: 28px;
								border-radius: 5px;
								background-image: linear-gradient(to top right, #646464, #4a939e);
								border-bottom: #222222 solid 2px;

								a {
									color: #080808;
									text-decoration: none;
								}

								.imges {
									width: 16px;
									height: 16px;
									display: flex;
									position: relative;
									left: 83vw;
									top: -21px;

									image {
										width: 100%;
										height: 100%;
									}
								}

							}
						}

					}

				}
			}
		}

		.winfroted-glass {
			display: none;
		}

		.toptitle {
			display: none;
		}

		.righttop {
			display: none;
		}

		@media (max-width: 640px) {
			.frosted-glass .title {
				font-size: 2em;
			}
		}
	}

	.bubble-bgwall {
		position: relative;
		width: 100%;
		height: 100%;
		list-style: none;
		padding: 0;
		margin: 0;
		display: flex;
		flex-direction: column;
		align-items: flex-end;
	}

	.bubble {
		display: flex;
		position: absolute;
		bottom: -200px;
		justify-content: center;
		align-items: center;
		border-radius: 10px;
		width: 50px;
		height: 50px;
		background-color: rgba(255, 255, 255, 0.15);
		color: #44397a;
		animation: bubble 15s infinite;
	}

	.bubble:nth-child(1) {
		left: 10%;
	}

	.bubble:nth-child(2) {
		left: 20%;
		width: 90px;
		height: 90px;
		animation-duration: 7s;
		animation-delay: 2s;
	}

	.bubble:nth-child(3) {
		left: 25%;
		animation-delay: 4s;
	}

	.bubble:nth-child(4) {
		left: 40%;
		width: 60px;
		height: 60px;
		background-color: rgba(255, 255, 255, 0.3);
		animation-duration: 8s;
	}

	.bubble:nth-child(5) {
		left: 70%;
	}

	.bubble:nth-child(6) {
		left: 80%;
		width: 120px;
		height: 120px;
		background-color: rgba(255, 255, 255, 0.2);
		animation-delay: 3s;
	}

	.bubble:nth-child(7) {
		left: 32%;
		width: 160px;
		height: 160px;
		animation-delay: 2s;
	}

	.bubble:nth-child(8) {
		left: 55%;
		width: 40px;
		height: 40px;
		font-size: 12px;
		animation-duration: 15s;
		animation-delay: 4s;
	}

	.bubble:nth-child(9) {
		left: 25%;
		width: 40px;
		height: 40px;
		background-color: rgba(255, 255, 255, 0.3);
		font-size: 12px;
		animation-duration: 12s;
		animation-delay: 2s;
	}

	.bubble:nth-child(10) {
		left: 85%;
		width: 160px;
		height: 160px;
		animation-delay: 5s;
	}

	@keyframes bubble {
		0% {
			opacity: 0.5;
			transform: translateY(0) rotate(45deg);
		}

		25% {
			opacity: 0.75;
			transform: translateY(-400px) rotate(90deg);
		}

		50% {
			opacity: 1;
			transform: translateY(-600px) rotate(135deg);
		}

		100% {
			opacity: 0;
			transform: translateY(-1000px) rotate(180deg);
		}
	}

	@keyframes code {
		0% {
			opacity: 0;
		}

		100% {
			opacity: 1;
		}
	}
</style>